package com.imnc.foodmap.view;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.PoiOverlay;
import com.baidu.mapapi.search.MKPoiInfo;
import com.baidu.mapapi.search.MKSearch;
import com.imnc.foodmap.model.PoiInfoParcelable;
import com.imnc.foodmap.ui.MainActivity;
import com.imnc.foodmap.ui.MapActivity;
import com.imnc.foodmap.ui.PoiResultDetailActivity;

public class EatMapPoiOverlay extends PoiOverlay {

	// private MKSearch mSearch;
	private Activity mContext;

	public EatMapPoiOverlay(Activity activity, MapView mapView, MKSearch search) {
		super(activity, mapView);
		mContext = activity;
		// mSearch = search;
	}

	@Override
	protected boolean onTap(int i) {
		super.onTap(i);
		MKPoiInfo info = getPoi(i);

		// View view = LayoutInflater.from(mContext).inflate(R.layout.pop,
		// null);

		// pop.showPopup(view, info.pt, 32);

		// if (info.hasCaterDetails) {
		// mSearch.poiDetailSearch(info.uid);
		// } else {
		Intent intent = new Intent(mContext, PoiResultDetailActivity.class);

		PoiInfoParcelable poiInfoParcelable = new PoiInfoParcelable(info);
		Bundle bundle = new Bundle();
		bundle.putParcelable(MainActivity.MAP_ALL_POI_RESULT, poiInfoParcelable);
		bundle.putInt(MapActivity.LOAD_TYPE, MapActivity.POI_LOAD);
		intent.putExtras(bundle);
		mContext.startActivityForResult(intent,
				MapActivity.REQUEST_ROUTE_PLANNING);
		// }
		return false;
	}

}
